package lab03.test01;

import java.io.*;

public class Test01 {
    public static void main(String[] args) {

        String path = "E:\\hello.txt";//文件的绝对路径
        File sc = new File(path);
        System.out.println("文件名：" + sc.getName());
        System.out.println("路径：" + sc.getParentFile());
        System.out.println("绝对路径：" + sc.getAbsoluteFile());
        System.out.println("绝对路径：" + sc.getAbsolutePath());
        try {
            BufferedReader reader = new BufferedReader(new FileReader(path));
            String line = reader.readLine();
            System.out.println(line);
            while (true) {
                line = reader.readLine();
                if (line == null) {
                    break;
                } else {
                    System.out.println(line);
                }
            }
            reader.close();

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    /*
    * 读文件的基本操作：读一个文件并打印文件内容
    * */
        //1.字节流来读   1.1 一次读一行字符

    }
}